﻿// Copyright 2007-2008 Rory Plaire (codekaizen@gmail.com)

using System;

namespace NPack.Interfaces
{
    /// <summary>
    /// Every class that defines an unary inverse operation such that
    /// <c>x * inverse(x) ~= e</c> and <c>inverse(inverse(x)) ~= x</c> for all x except Zero
    /// should consider implementing this interface. 
    /// Types that might want to implement this would be non-integral types <see cref="Single"/>, 
    /// <see cref="Double"/>, <see cref="Decimal"/>, but not integral types like <see cref="Int16"/>, 
    /// <see cref="Int32"/>, or <see cref="Int64"/>, etc.
    /// </summary>
    /// <typeparam name="T">Type which is invertible.</typeparam>
    /// <remarks>
    /// Adapted from an article on lambda-computing.com: 
    /// http://www.lambda-computing.com/publications/articles/generics/IArithmetic.cs.
    /// </remarks>
    public interface IInvertible<T> : IDivisible<T>, IHasOne<T>
    {
        /// <summary>
        /// Returns the inverse.
        /// </summary>
        /// <returns>The inverse.</returns>
        T Inverse();
    }
}
